package com.codergd.gra.dao;

import com.codergd.gra.bean.UserRe;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserReDao {

    @Insert("insert into userre(uid,jid,job,cid,state,uname,sallow,sal,content,resume,cname,address) " +
            "values (#{uid},#{jid},#{job},#{cid},#{state},#{uname},#{sallow},#{sal},#{content},#{resume},#{cname},#{address})")
    public int addUserRe(UserRe userRe);

    @Update("update userre set state=#{state} where id=#{id}")
    public int updateState(int id,int state);

    @Select("select * from userre where cid=#{cid} and (state=0 or state =1)")
    public List<UserRe> userReC(int cid,int state);

    @Select("select * from userre where cid=#{cid} and state=2")
    public List<UserRe> userReC1(int cid,int state);

    @Select("select * from userre where cid=#{cid} and state=#{state}")
    public List<UserRe> userReC3(int cid,int state);

    @Select("select * from userre where uid=#{uid} and state=#{state}")
    public List<UserRe> userReU(int uid,int state);

    @Select("select * from userre where uid=#{uid} and (state=3 or state=6 or state=8 or state=9 or state=10)")
    public List<UserRe> userReUM(int uid);

    @Update("update userre set py=#{py} where id=#{id}")
    public int updatePy(int id,String py);

    @Update("update userre set score=#{score} where id=#{id}")
    public int updateScore(int id,int score);
}
